//导入vue-router
import { createRouter, createWebHistory } from 'vue-router'

//导入组件
import LoginVue from '../views/login/index.vue'
import MainVue from '../views/main/index.vue'
import GoodsVue from '../views/goods/index.vue'
import GoodStypeVue from '../views/goodStype/index.vue'
import RecordVue from '../views/record/index.vue'
import StorageVue from '../views/storage/index.vue'
import UsersVue from '../views/users/index.vue'
//定义路由关系
const routes = [
    { path: '/login', component: LoginVue },
    {
        path: '/', component: MainVue, redirect: '/goods',
        children: [
            //子路由
            {
                path: '/goods', component: GoodsVue
            },
            {
                path: '/goodStype', component: GoodStypeVue
            },
            {
                path: '/record', component: RecordVue
            },
            {
                path: '/storage', component: StorageVue
            },
            {
                path: '/users', component: UsersVue
            }
        ]
    },

]

//创建路由实例
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

export default router

